package com.marosoft;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * @author aizaz.haider
 * 
 */

public class MapLegendHelper {

	// =================================================
	// CLASS VARIABLES
	// =================================================
	private TextView mSiteName;
	private TextView mFloorNum;
	private TextView mElevation;
	private TextView mCareer;
	private TextView mNetworkType;
	private TextView mDataNetwork;

	// ---Value of legend values
	private TextView mTv1;
	private TextView mTv2;
	private TextView mTv3;
	private TextView mTv4;
	private TextView mTv5;
	private TextView mTv6;
	private TextView mTv7;
	private TextView mTvCopyRight;
	private TextView mTvRevHistory_tv1;
	private TextView mTvRevHistory_tv2;
	private TextView mTvRevHistory_tv3;
	private TextView mTvRevHistory_tv4;
	private TextView mTvRevHistory_tv5;
	private TextView mTvProjName;
	private TextView mTvPlanValue;
	private TextView mTvDateLogo;
	private TextView mTvOtherInfo;

	private ImageView mIv1;
	private ImageView mIv2;
	private ImageView mIv3;
	private ImageView mIv4;
	private ImageView mIv5;
	private ImageView mIv6;
	private ImageView mIv7;
	private ImageView mIvLogo;

	private Context mContext;
	RelativeLayout mView;

	// =================================================
	// CONSTANTS
	// =================================================

	// =================================================
	// CONSTRUCTOR
	// =================================================
	public MapLegendHelper(Context pContext) {
		this.mContext = pContext;

		LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mView = (RelativeLayout) inflater.inflate(R.layout.map_legend_logo, null);

//		this.initializeElements();
	}

	// =================================================
	// METHODS
	// =================================================
	private void initializeElements() {
		mSiteName = (TextView) mView.findViewById(R.id.ml_tv_site_value);
		mFloorNum = (TextView) mView.findViewById(R.id.ml_tv_floor_value);
		mElevation = (TextView) mView.findViewById(R.id.ml_tv_elevation_value);
		mCareer = (TextView) mView.findViewById(R.id.ml_tv_carrier_value);
		mNetworkType = (TextView) mView.findViewById(R.id.ml_tv_net_type_value);
		mDataNetwork = (TextView) mView.findViewById(R.id.ml_tv_data_net_value);

		mTv1 = (TextView) mView.findViewById(R.id.ml_tv1);
		mTv2 = (TextView) mView.findViewById(R.id.ml_tv2);
		mTv3 = (TextView) mView.findViewById(R.id.ml_tv3);
		mTv4 = (TextView) mView.findViewById(R.id.ml_tv4);
		mTv5 = (TextView) mView.findViewById(R.id.ml_tv5);
		mTv6 = (TextView) mView.findViewById(R.id.ml_tv6);
		mTv7 = (TextView) mView.findViewById(R.id.ml_tv7);
		mTvCopyRight = (TextView) mView.findViewById(R.id.ml_tv_copy_right_value);
		mTvRevHistory_tv1 = (TextView)mView.findViewById(R.id.ml_tv1_rev_history);
		mTvRevHistory_tv2 = (TextView)mView.findViewById(R.id.ml_tv2_rev_history);
		mTvRevHistory_tv3 = (TextView)mView.findViewById(R.id.ml_tv3_rev_history);
		mTvRevHistory_tv4 = (TextView)mView.findViewById(R.id.ml_tv4_rev_history);
		mTvRevHistory_tv5 = (TextView)mView.findViewById(R.id.ml_tv5_rev_history);
		mTvProjName = (TextView)mView.findViewById(R.id.ml_tv_proj_name_value);
		mTvDateLogo = (TextView)mView.findViewById(R.id.ml_tv_date);
		mTvOtherInfo = (TextView)mView.findViewById(R.id.ml_tv_other_info);

		mIv1 = (ImageView) mView.findViewById(R.id.ml_iv1);
		mIv2 = (ImageView) mView.findViewById(R.id.ml_iv2);
		mIv3 = (ImageView) mView.findViewById(R.id.ml_iv3);
		mIv4 = (ImageView) mView.findViewById(R.id.ml_iv4);
		mIv5 = (ImageView) mView.findViewById(R.id.ml_iv5);
		mIv6 = (ImageView) mView.findViewById(R.id.ml_iv6);
		mIv7 = (ImageView) mView.findViewById(R.id.ml_iv7);
		mIvLogo = (ImageView) mView.findViewById(R.id.ml_iv_logo);
	}

	// =================================================
	// METHODS FOR/FROM SUPER CLASSES/INTERFACES
	// =================================================
	private void setValue(TextView pTv, String pValue) {
		pTv.setText(pValue);
	}

	private void setValue(ImageView pIv, LegendColor pColor) {
		ColorDrawable color = new ColorDrawable(Color.parseColor(pColor.getColorValue()));
		pIv.setBackgroundDrawable(color);
	}

	// =================================================
	// GETTER 'N' SETTER
	// =================================================
	public RelativeLayout getView() {
		return mView;
	}

	public TextView getSiteName() {
		return mSiteName;
	}

	public void setSiteName(TextView mSiteName) {
		this.mSiteName = mSiteName;
	}

	public void setSiteName(String pText) {
		this.setValue(this.mSiteName, pText);
	}

	public TextView getFloorNum() {
		return mFloorNum;
	}

	public void setFloorNum(TextView mFloorNum) {
		this.mFloorNum = mFloorNum;
	}

	public void setFloorNum(String pText) {
		this.setValue(this.mFloorNum, pText);
	}

	public TextView getElevation() {
		return mElevation;
	}

	public void setElevation(TextView mElevation) {
		this.mElevation = mElevation;
	}

	public void setElevation(String pText) {
		this.setValue(this.mElevation, pText);
	}

	public TextView getCareer() {
		return mCareer;
	}

	public void setCareer(TextView mCareer) {
		this.mCareer = mCareer;
	}

	public void setCareer(String pText) {
		this.setValue(this.mCareer, pText);
	}

	public TextView getNetworkType() {
		return mNetworkType;
	}

	public void setNetworkType(TextView mNetworkType) {
		this.mNetworkType = mNetworkType;
	}

	public void setNetworkType(String pText) {
		this.setValue(this.mNetworkType, pText);
	}

	public TextView getDataNetwork() {
		return mDataNetwork;
	}

	public void setDataNetwork(TextView mDataNetwork) {
		this.mDataNetwork = mDataNetwork;
	}

	public void setDataNetwork(String pText) {
		this.setValue(this.mDataNetwork, pText);
	}

	public TextView getTv1() {
		return mTv1;
	}

	public void setTv1(TextView mTv1) {
		this.mTv1 = mTv1;
	}

	public void setTv1(String pText) {
		this.setValue(this.mTv1, pText);
	}

	public TextView getTv2() {
		return mTv2;
	}

	public void setTv2(TextView mTv2) {
		this.mTv2 = mTv2;
	}

	public void setTv2(String pText) {
		this.setValue(this.mTv2, pText);
	}

	public TextView getTv3() {
		return mTv3;
	}

	public void setTv3(TextView mTv3) {
		this.mTv3 = mTv3;
	}

	public void setTv3(String pText) {
		this.setValue(this.mTv3, pText);
	}

	public TextView getTv4() {
		return mTv4;
	}

	public void setTv4(TextView mTv4) {
		this.mTv4 = mTv4;
	}

	public void setTv4(String pText) {
		this.setValue(this.mTv4, pText);
	}

	public TextView getTv5() {
		return mTv5;
	}

	public void setTv5(TextView mTv5) {
		this.mTv5 = mTv5;
	}

	public void setTv5(String pText) {
		this.setValue(this.mTv5, pText);
	}

	public TextView getTv6() {
		return mTv6;
	}

	public void setTv6(TextView mTv6) {
		this.mTv6 = mTv6;
	}

	public void setTv6(String pText) {
		this.setValue(this.mTv6, pText);
	}

	public TextView getTv7() {
		return mTv7;
	}

	public void setTv7(TextView mTv7) {
		this.mTv7 = mTv7;
	}

	public void setTv7(String pText) {
		this.setValue(this.mTv7, pText);
	}

	public ImageView getIv1() {
		return mIv1;
	}

	public void setIv1(ImageView mIv1) {
		this.mIv1 = mIv1;
	}

	public void setIv1(LegendColor pColor) {
		this.setValue(this.mIv1, pColor);
	}

	public ImageView getIv2() {
		return mIv2;
	}

	public void setIv2(ImageView mIv2) {
		this.mIv2 = mIv2;
	}

	public void setIv2(LegendColor pColor) {
		this.setValue(this.mIv2, pColor);
	}

	public ImageView getIv3() {
		return mIv3;
	}

	public void setIv3(ImageView mIv3) {
		this.mIv3 = mIv3;
	}

	public void setIv3(LegendColor pColor) {
		this.setValue(this.mIv3, pColor);
	}

	public ImageView getIv4() {
		return mIv4;
	}

	public void setIv4(ImageView mIv4) {
		this.mIv4 = mIv4;
	}

	public void setIv4(LegendColor pColor) {
		this.setValue(this.mIv4, pColor);
	}

	public ImageView getIv5() {
		return mIv5;
	}

	public void setIv5(ImageView mIv5) {
		this.mIv5 = mIv5;
	}

	public void setIv5(LegendColor pColor) {
		this.setValue(this.mIv5, pColor);
	}

	public ImageView getIv6() {
		return mIv6;
	}

	public void setIv6(ImageView mIv6) {
		this.mIv6 = mIv6;
	}

	public void setIv6(LegendColor pColor) {
		this.setValue(this.mIv6, pColor);
	}

	public ImageView getIv7() {
		return mIv7;
	}

	public void setIv7(ImageView mIv7) {
		this.mIv7 = mIv7;
	}

	public void setIv7(LegendColor pColor) {
		this.setValue(this.mIv7, pColor);
	}

	// =================================================
	// ANONYMOUS CLASS/INTERFACES
	// =================================================
	public enum LegendColor {
		RED("#AF2345"), BLUE("#AF2345"), GREEN("#AF2345"), GREY("#AF2345");

		private final String colorHexValue;

		LegendColor(String pHexValue) {
			this.colorHexValue = pHexValue;
		}

		public String getColorValue() {
			return colorHexValue;
		}
	}
}
